import createRouter from './router.js'
const router = createRouter()
router.beforeEach(function(to, from, next) {
  console.log(to, from)
  console.log(`before`)
  if (to.name == 'index') {
    uni.showToast({
      title: '准备跳转首页3s后跳转',
      icon: 'none'
    })
    setTimeout(() => {
      next()
    }, 3e3)
  } else {
    next()
  }
})

router.afterEach((to, from) => {
  console.log(`after`, to, from)
})

export default router
